﻿@model Sdari.Api.DbModel.ConsumerInfo

@{
    ViewData["Title"] = "Create";
}

<h1>Create</h1>

<h4>ConsumerInfo</h4>
<hr />
<div class="row">
    <div class="col-md-4">
        <form asp-action="Create">
            <div asp-validation-summary="ModelOnly" class="text-danger"></div>
            <div class="form-group">
                <label asp-for="Name" class="control-label"></label>
                <input asp-for="Name" class="form-control" />
                <span asp-validation-for="Name" class="text-danger"></span>
            </div>
            <div class="form-group">
                <label asp-for="ClientId" class="control-label"></label>
                <input asp-for="ClientId" class="form-control" readonly id="ClientId"/>
                <span asp-validation-for="ClientId" class="text-danger"></span>
            </div>
            <div class="form-group">
                <label asp-for="Secret" class="control-label"></label>
                <input asp-for="Secret" class="form-control" readonly id="Secret"/>
                <span asp-validation-for="Secret" class="text-danger"></span>
                <button type="button" class="btn btn-default" onclick="setClientSecret($('#ClientId'),$('#Secret'))">Generate</button>
            </div>
            <div class="form-group">
                <label asp-for="Ipv4" class="control-label"></label>
                <div class="row-fluid form-inline">
                @for(int i = 0; i < 4; i++)
                {
                    <input class="form-control" type="number" max="255" min="0" id="ipv4_@i" name="Ipv4[@i]" />
                    <span>.</span>
                    @*@Html.TextBoxFor(model=>model.Ipv4[i],new {maxlength=3})*@
                }
                </div>
                @*<input asp-for="Ipv4" class="form-control" />*@
                <span asp-validation-for="Ipv4" class="text-danger"></span>
            </div>
            <div class="form-group">
                <label asp-for="Ipv6" class="control-label"></label>
                <input asp-for="Ipv6" class="form-control" />
                <span asp-validation-for="Ipv6" class="text-danger"></span>
            </div>
            <div class="form-group">
                <label asp-for="Description" class="control-label"></label>
                <input asp-for="Description" class="form-control" />
                <span asp-validation-for="Description" class="text-danger"></span>
            </div>
            <div class="form-group">
                <input type="submit" value="Create" class="btn btn-primary" />
            </div>
        </form>
    </div>
</div>

<div>
    <a asp-action="Index">Back to List</a>
</div>

@section Scripts {
    @{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
}
